package com.siqi.hr.system.custom.service;

import com.siqi.hr.system.custom.dao.intf.QueryDao;
import com.siqi.hr.system.custom.entity.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 查询条件service层
 * @author     xiaogq
 * Created by xiaogoingqin on 2016/7/24.
 */
@Service("queryService")
@Transactional(rollbackFor = { Exception.class }, propagation = Propagation.REQUIRED)
public class QueryService {

    @Autowired
    private QueryDao queryDao;

    /**
     * 查询定制查询列表数据
     * @author                     xiaogq
     * @param employeeId         当前登录系统的用户Id
     * @param entityId            实体Id
     * @return
     */
    public List<Query> queryListShowCustQueryList(String employeeId, Integer entityId) {
        List<Query> queryList = queryDao.queryListShowCustQueryList(employeeId,entityId);

        return queryList;
    }

    /**
     * 删除字段时清空定制查询，查询另存为条件中的字段信息
     * @author                     xiaogq
     * @param tableCode     实体id
     * @param fieldName     字段名称
     */
    public void removeFieldFromCondition(Integer tableCode, String fieldName) {
        queryDao.removeFieldFromCondition(tableCode, fieldName);
    }

}
